package manong.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import manong.beans.manager;
import manong.beans.selecourse;
import manong.service.lessonService;
import manong.service.managerService;
import manong.service.selectCourseService;

@Controller 
@RequestMapping("/manong")
public class selectCourseController {
	 @Resource 
	 selectCourseService scourseservice;
     @Resource
  	lessonService lessonservice;
	/*
	 * @RequestMapping("/getAllCourse") public String getAllCourse(ModelMap m) {
	 * List<selecourse> course=scourseservice.getAll_course(); m.put("course",
	 * course); return "web-pages/Manager-selectcourse"; }
	 */
     
		/*
		 * @RequestMapping("/getAllCourse") public String getAllCourse() { return
		 * "web-pages/Manager-selectcourse"; }
		 * 
		 * @GetMapping("/getpageInfo_course")
		 * 
		 * @ResponseBody public List<selecourse> getpageInfo_course() {
		 * 
		 * return scourseservice.pageInfo_course(1, 5); }
		 */

	 @RequestMapping("/getAllCourse")
	 public String getAllCourse(Model model,
			 @RequestParam(name = "page", defaultValue = "1", required = false) int page,
             @RequestParam(name = "size", defaultValue = "5", required = false) int size) {
		 List<selecourse> courseList = scourseservice.getAllCourse(page, size);
	        PageInfo pageInfo = new PageInfo(courseList);
	        model.addAttribute("pageInfo", pageInfo);
		 
		 return"web-pages/Manager-selectcourse";
	 }
	 

}
